package com.sc.controller;

import java.util.HashMap;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sc.bean.Note;
import com.sc.serviceimpl.QueryNoteByIdServiceImple;

@Controller
public class NoteController {
	@Autowired
	private QueryNoteByIdServiceImple noteByIdImple;
	
/*	@Autowired
	private QueryNoteServiceImple noteImple;

	@RequestMapping("/queryNote")
	@ResponseBody
	public Map<String,Object> queryNote(HttpServletRequest request,int curr)
	{
		PageHelper.startPage(curr,3);
		List<Note> list=noteImple.queryNote();
		PageInfo<Note> page=new PageInfo<Note>(list);
		int totle=noteImple.totleNote();
		page.setTotal(totle);
		System.out.println("总数："+page.getTotal());
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("list", list);
		map.put("pages", page.getPageNum());
		map.put("pageTotle", page.getTotal());
		return map;
		
	}
	*/
	
	//根据条件查询
	@RequestMapping("/queryNoteById")
	@ResponseBody
	public Map<String,Object> queryNoteById(int n_id)
	{
		Map<String,Object> map=new HashMap<String,Object>();
		System.out.println("n_id==="+n_id);
		Note note=noteByIdImple.queryNote(n_id);
		System.out.println(note);
		map.put("note", note);
		return map;
		
		
		
	}
	
}
